<?php
declare (strict_types = 1);

namespace app\month\middleware;

use app\api\server\Token;

class Check
{
    /**
     * 处理请求
     *
     * @param \think\Request $request
     * @param \Closure       $next
     * @return Response
     */
    public function handle($request, \Closure $next)
    {
        /**
         * 登录验证
         */
        $uid = Token::verifyToken();


        if ($uid) {
            $request->uid = $uid;
            return $next($request);
        }

        return  fail(1001,"请先登录");
    }
}
